<?php $this->load->view('admin/public/head.html', array('css' => array(
'/assets/admin/css/admin/common.css',
))); ?>

<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper" ng-controller="admin-money-purchaser-detail">
    <!-- Content Header (Page header) -->
    <section class="content-header">
        <h1>
            账务管理
            <small>用户账务管理模块</small>
        </h1>
        <ol class="breadcrumb">
            <li><a href="#"><i class="fa fa-dashboard"></i> 后台首页</a></li>
            <li class="active">对账单详情</li>
        </ol>
    </section>

    <!-- Main content -->
    <section class="content p">

        <div class="row">
            <!-- 列表 -->
            <div class="col-md-12">
                <div class="box" style="padding-bottom: 30px;">
                    <p style="height: 30px;line-height: 30px; padding-left: 20px; background: #EFEFEF; color: #CCCCCC;">商家应得收入 = 交易总额 - 用户退款金额 - 货到付款交易金额</p>

                    <div class="p-banner">
                        <ul>
                            <li class="r-border">
                                <strong><?=$data['count']?></strong>
                                <p>订单量</p>
                            </li>
                            <li class="r-border">
                                <strong style="color: red;"><?=$data['total']?></strong>
                                <p>交易总额</p>
                            </li>
                            <li class="r-border">
                                <strong style="color: #00a65a;"><?=$data['delivery']?></strong>
                                <p>货到付款</p>
                            </li>
                            <li class="r-border">
                                <strong style="color: #00a65a;"><?=$data['refund']?></strong>
                                <p>退款</p>
                            </li>
                            <li>
                                <strong class="text-warning"><?=$data['amount']?></strong>
                                <p>商家应得</p>
                            </li>
                            <li class="p-btn">
                                <button class="btn btn-default active" ng-click="complete(<?=$info['id']?>, <?=$info['baseId']?>)">完成对账</button>
                            </li>
                        </ul>
                    </div>

                    <p style="height: 30px;line-height: 30px; padding-left: 20px; background: #EFEFEF; color: #CCCCCC;">对账单时间区间: <?=value($info, 'year') . '年' . value($info, 'month') . '月'?></p>
                    <!--
                    <h4 class="p-desc">对账单时间区间: <?=value($info, 'year') . '年' . value($info, 'month') . '月'?></h4>
                    -->

                    <form class="form-horizontal">
                        <div class="box-body">
                            <div class="form-group">
                                <label class="col-sm-2 control-label">基地名称</label>
                                <div class="col-sm-6">
                                    <p class="form-control-static"><?=$base['name']?> &nbsp;&nbsp; <a href="/bill/history/index?baseId=<?=$base['id']?>">往期对账单</a></p>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">银行名称</label>
                                <div class="col-sm-6">
                                    <p class="form-control-static"><?=$info['bankname']?></p>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">开户银行</label>
                                <div class="col-sm-6">
                                    <p class="form-control-static"><?=$info['kaihuhang']?></p>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">收款人</label>
                                <div class="col-sm-6">
                                    <p class="form-control-static"><?=$info['username']?></p>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">收款账号</label>
                                <div class="col-sm-6">
                                    <p class="form-control-static"><?=$info['account']?></p>
                                </div>
                            </div>
                        </div>
                    </form>

                    <div class="pull-right" style="height: 30px; line-height: 30px;"><a href="/bill/purchaser/export?id=<?=$info['id']?>" style="margin-right: 25px; color: #00a65a; text-decoration: underline;">下载数据</a></div>
                    <table class="table">
                        <tr>
                            <th class="text-center">#</th>
                            <th class="text-center">订单号</th>
                            <th class="text-center">结算时间</th>
                            <th class="text-center">结算金额</th>
                            <th class="text-center">退款金额</th>
                            <th class="text-center">分销佣金</th>
                            <th class="text-center">用户类型</th>
                            <th class="text-center">支付类型</th>
                            <th class="text-center">支付方式</th>
                        </tr>
                        <?php if(!empty($data['lists'])):?>
                        <?php foreach($data['lists'] as $item):?>
                        <tr>
                            <td class="text-center"><?=$item['id']?></td>
                            <td class="text-center">
                                <a href="###"><?=$item['sn']?></a>
                            </td>
                            <td class="text-center"><?=$item['compTime']?></td>
                            <td class="text-center"><?=$item['totalPrice']?></td>
                            <td class="text-center">0</td>
                            <td class="text-center">0</td>
                            <td class="text-center">
                                <?php if($item['priceType'] == 1):?>
                                    <span>采购商</span>
                                <?php else:?>
                                    <span>普通用户</span>
                                <?php endif;?>
                            </td>
                            <td class="text-center">
                                <?php if($item['payMode'] == 'online'):?>
                                <span>在线支付</span>
                                <?php else:?>
                                <span>货到付款</span>
                                <?php endif;?>
                            </td>
                            <td class="text-center">
                                <?php if($item['payWay'] == 1):?>
                                <span>支付宝</span>
                                <?php else:?>
                                <span>微信</span>
                                <?php endif;?>
                            </td>
                        </tr>
                        <?php endforeach;?>
                        <?php else:?>
                        <tr ng-if="result.lists && result.lists.length == 0">
                            <td colspan="9" class="text-center" style="color: #CCCCCC;">暂无订单</td>
                        </tr>
                        <?php endif;?>
                    </table>
                </div>
            </div>

        </div>
    </section>
    <!-- /.content -->
</div>

<!-- /.content-wrapper -->
<?php $this->load->view('admin/public/foot.html', array(
'js' => array(
    '/assets/admin/js/money/purchaser/detail.js',
)
)); ?>
